import an46 from '@dfeidao/fd-an000046';
import an7 from '@dfeidao/fd-an000007';
import an82 from '@dfeidao/fd-an000082';
import { IncomingHttpHeaders } from 'http';
import { systemid } from '../../atom/config';

interface Message {
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders): Promise<an82> {
	an7('Service begin path:pg002/zj-001/s002,action_id:' + action_id);
	// 数据表查询
	const ran46 = an46(headers, systemid);
	interface IDataTable1 {
		auto_score_state: string;
		id: string;
	}
	(() => {
		const table = 'race_test_paper';		// 表名
		const query_fields = ['auto_score_state', 'id'];	// 查询的字段名
		const query_filter = {};	// 查询条件
		const page_size = 20;	// 单页显示的数据条数
		const page_no = 1;			// 当前页码,从1开始
		const sort_fields_asc = ['auto_score_state'] as string[];	// 正序排序字段名
		const sort_fields_desc = ['id'] as string[];	// 正序排序字段名
		const resourceno = [] as string[];	// 资源编号
		ran46.prepare(table, query_fields, query_filter, page_size, page_no, sort_fields_asc, sort_fields_desc, resourceno);
	})();
	const [data1] = await ran46.exec<IDataTable1>();

	an7('Service end path:pg002/zj-001/s002,action_id:' + action_id);
	return {
		data: data1
	} as an82;
}
